import pandas as pd
from sqlalchemy import create_engine
import pymysql

engine = create_engine("mysql+pymysql://root:123456@localhost:3306/nacos_config")
connection = pymysql.connect(
    host="192.168.0.135", user="root", password="123456", db="nacos_config"
)
f1 = open("nanshan.yml", "r")
res = ""
for line1 in f1.readlines():
    line1 = line1.strip("\n")
    res += line1 + "\n"
print(res)
sql = "update config_info set content='" + res + "' where data_id='test'"
print(sql)
cur = connection.cursor()
cur.execute(sql)
cur.connection.commit()
print(cur.fetchall())
cur.close()
connection.close()
